package com.ark.cloud.javacallnative.modules.storage.service.impl;

import com.ark.cloud.javacallnative.entity.SatelliteCmd;
import com.ark.cloud.javacallnative.modules.storage.mapper.SatelliteCmdMapper;
import com.ark.cloud.javacallnative.modules.storage.service.SatelliteCmdService;
import com.ark.cloud.javacallnative.util.UUIDUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class SatelliteCmdServiceImpl extends ServiceImpl<SatelliteCmdMapper, SatelliteCmd> implements SatelliteCmdService {

    @Autowired
    private SatelliteCmdMapper satelliteCmdMapper;

    @Override
    public void saveSatelliteCmd(SatelliteCmd satelliteCmd) {
        satelliteCmd.setId(UUIDUtil.next());
        double[][] impulse = satelliteCmd.getImpulse();
        satelliteCmd.setImpulseA(impulse.toString());

        double[] formationPara = satelliteCmd.getFormationPara();
        satelliteCmd.setFormationParaA(formationPara.toString());

        System.out.println("satelliteCmd:"+satelliteCmd);

        satelliteCmdMapper.insert(satelliteCmd);
    }
}
